﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

<html>
  <head>
    <title>Weaver Project
</title>


<script type="text/javascript" src="js/base64-min.js"></script>
<script type="text/javascript" src="js/json2-min.js"></script>
<script type="text/javascript" src="js/ServerFunctionExecutor-min.js"></script>
<script type="text/javascript" src="js/gate1C.js"></script>
<script type="text/javascript">

var connectionInfo;

function onLoad()
{
  document.getElementById('eHost').value = "localhost";
  document.getElementById('ePort').value = "8080";

  document.getElementById('eDBAlias').value = "Test";
  document.getElementById('eModule').value = "Test1.ert";

}

function getValue(eName)
{
  return document.getElementById(eName).value
}

function setConnectionProperty(host, port, password)
{
  connectionInfo = {"host":host,"port":port,"authentication":null,"pathPrefix":''};
  connectionInfo.authentication = convertStringToBase64("webUser:" + password);
}

function onExecute()
{
  var  eResult = document.getElementById('eResult');
  eResult.value = "Выполняется...";

  setConnectionProperty(getValue('eHost'), getValue('ePort'), getValue('ePwd'));
  var gate1C = new TGate1C(connectionInfo);
   
//  var oBj = JSON.parse(getValue('eParams'));
  var ss = {"СписокЗначений":["000122", "000125", "000129"]};

  var s = gate1C.WebExec1CModule(getValue('eDBAlias'), getValue('eModule'), ss);
  if (s != null)
  {
    eResult.value = s.result;   // JSON.stringify(s.result);
    //eResult.value = JSON.stringify(s.result);
  } else
  {
    eResult.value = "Ошибка авторизации или критическая ошибка на сервере";
  }
}



</script>
  </head>

  <body onload="onLoad()" ms_positioning="GridLayout">
    <div style="Z-INDEX: 1; POSITION: absolute; WIDTH: 117px; DISPLAY: inline; HEIGHT: 21px; TOP: 166px; LEFT: 14px" ms_positioning="FlowLayout">Имя БД 1С
</div><input style="Z-INDEX: 2; POSITION: absolute; WIDTH: 325px; HEIGHT: 13px; TOP: 166px; LEFT: 158px" id="eDBAlias" size="1">
    <div style="Z-INDEX: 3; POSITION: absolute; WIDTH: 117px; DISPLAY: inline; HEIGHT: 19px; TOP: 230px; LEFT: 14px" ms_positioning="FlowLayout">Параметры
</div><input
           style="Z-INDEX: 2; POSITION: absolute; WIDTH: 325px; HEIGHT: 75px; TOP: 236px; LEFT: 158px" id="eParams" size="24">
    <div style="Z-INDEX: 4; POSITION: absolute; WIDTH: 477px; DISPLAY: inline; HEIGHT: 29px; TOP: 14px; LEFT: 14px" ms_positioning="FlowLayout"><font size="4"><strong>Пример вызова WebExec1CModule
</strong>
      </font>
    </div><input
           style="Z-INDEX: 5; POSITION: absolute; WIDTH: 117px; HEIGHT: 24px; TOP: 322px; LEFT: 374px" id="btExec" value="Выполнить" size="35" type="button" onclick="javascript:onExecute();">
    <div style="Z-INDEX: 6; POSITION: absolute; WIDTH: 117px; DISPLAY: inline; HEIGHT: 21px; TOP: 54px; LEFT: 14px" ms_positioning="FlowLayout">Адрес сервера
</div><input style="Z-INDEX: 2; POSITION: absolute; WIDTH: 227px; HEIGHT: 13px; TOP: 54px; LEFT: 158px" id="eHost" size="1">
    <div style="Z-INDEX: 7; POSITION: absolute; WIDTH: 37px; DISPLAY: inline; HEIGHT: 19px; TOP: 54px; LEFT: 398px" ms_positioning="FlowLayout">Порт
</div><input
           style="Z-INDEX: 9; POSITION: absolute; WIDTH: 45px; HEIGHT: 13px; TOP: 54px; LEFT: 438px" id="ePort" size="1">
    <div style="Z-INDEX: 10; POSITION: absolute; WIDTH: 117px; DISPLAY: inline; HEIGHT: 19px; TOP: 86px; LEFT: 14px" ms_positioning="FlowLayout">Пароль
</div><input style="Z-INDEX: 2; POSITION: absolute; WIDTH: 325px; HEIGHT: 13px; TOP: 86px; LEFT: 158px" id="ePwd" size="1">
    <div style="Z-INDEX: 13; POSITION: absolute; WIDTH: 181px; DISPLAY: inline; HEIGHT: 19px; TOP: 358px; LEFT: 14px" ms_positioning="FlowLayout">Результат выполнения
</div><input
           style="Z-INDEX: 2; POSITION: absolute; WIDTH: 469px; HEIGHT: 75px; TOP: 382px; LEFT: 14px" id="eResult" size="42"><input style="Z-INDEX: 2; POSITION: absolute; WIDTH: 325px; HEIGHT: 13px; TOP: 198px; LEFT: 158px" id="eModule" size="1">
    <div style="Z-INDEX: 15; POSITION: absolute; WIDTH: 117px; DISPLAY: inline; HEIGHT: 21px; TOP: 190px; LEFT: 14px" ms_positioning="FlowLayout">
      <p>Модуль
</p>
    </div>

  </body>
</html>
